package com.mediacloud.app.newsmodule.fragment.groupimg;



import com.mediacloud.app.newsmodule.adaptor.NewsListItemStyleAdaptor;
import com.mediacloud.app.newsmodule.adaptor.bigimg_nosliceline.BigImageNoSliceLineAdaptor;
import com.mediacloud.app.newsmodule.adaptor.groupimage.GroupPhotoNewsListItemStyleAdaptor;
import com.mediacloud.app.newsmodule.fragment.newslist.NewsListWidthBannerFragment;
import com.mediacloud.app.reslib.enums.StyleOther;

/**
 *组图
 *
 *
 */
public class GroupImgNewsListFragment extends NewsListWidthBannerFragment {

	public GroupImgNewsListFragment() {
	}

	@Override
	public void initView() {
		super.initView();
		//如果有其他样式的 就用这个列表样式了
        if (adaptor instanceof BigImageNoSliceLineAdaptor){
            ((BigImageNoSliceLineAdaptor) adaptor).destroy();
        }
        if (adaptor instanceof NewsListItemStyleAdaptor){
            ((NewsListItemStyleAdaptor) adaptor).destroy();
        }

		if(catalogItem.getCatalogStyle()== StyleOther.OtherStyle)//&&catalogItem.getStyleOther()!=null)
		{
			adaptor=new BigImageNoSliceLineAdaptor(getActivity(),catalogItem,playClickListener);
		} else {
			adaptor=new GroupPhotoNewsListItemStyleAdaptor(getActivity(), catalogItem);
		}
		mCatalogContentItemListView.setAdapter(adaptor);
	}

	@Override
	protected void addBanner()
	{
		int extraStyle=catalogItem!=null?catalogItem.getCatalogStyle():0;
		if(extraStyle>0)
			haveBanner=false;
		else
			super.addBanner();
	}

    @Override
    public void onDestroyView() {
        if (adaptor instanceof GroupPhotoNewsListItemStyleAdaptor){
            ((GroupPhotoNewsListItemStyleAdaptor) adaptor).clearEvent();
            ((GroupPhotoNewsListItemStyleAdaptor) adaptor).clearSpiderObservers();
        }
        super.onDestroyView();
    }
}